/*****************************************************************************
*        描述 :
*             文件描述
*        CLR版本:            3.5
*        创建者 :            蒋 光
*        个人域名:           jiangguang.net.cn
*        命名空间名称:       ECP.Model
*        文件名:             BaseWorkFlowStepEntity.cs
*        创建系统时间:       2012/11/2 19:07:04
*        创建年份:           2012
*
/*****************************************************************************/

namespace ECP.Model
{
    using System;
    using System.Data;

    [Serializable]
    public class BaseWorkFlowStepEntity
    {
        public string AudiDutyID;
        public string AudiRoleID;
        public string AudiUserID;
        public string CreateDate;
        public string CreateUserID;
        public string Description;
        public bool Enabled;
        public string FlowID;
        public string FullName;
        public string ID;
        public string ModifyDate;
        public string ModifyUserID;
        public string Property;
        public string SortCode;
        public string Step;

        public BaseWorkFlowStepEntity()
        {
            this.ID = string.Empty;
            this.Step = string.Empty;
            this.FlowID = string.Empty;
            this.FullName = string.Empty;
            this.Property = string.Empty;
            this.AudiUserID = string.Empty;
            this.AudiRoleID = string.Empty;
            this.AudiDutyID = string.Empty;
            this.SortCode = string.Empty;
            this.Description = string.Empty;
            this.CreateUserID = string.Empty;
            this.CreateDate = string.Empty;
            this.ModifyUserID = string.Empty;
            this.ModifyDate = string.Empty;
        }

        public BaseWorkFlowStepEntity(DataRow dataRow)
        {
            this.ID = string.Empty;
            this.Step = string.Empty;
            this.FlowID = string.Empty;
            this.FullName = string.Empty;
            this.Property = string.Empty;
            this.AudiUserID = string.Empty;
            this.AudiRoleID = string.Empty;
            this.AudiDutyID = string.Empty;
            this.SortCode = string.Empty;
            this.Description = string.Empty;
            this.CreateUserID = string.Empty;
            this.CreateDate = string.Empty;
            this.ModifyUserID = string.Empty;
            this.ModifyDate = string.Empty;
            this.GetFrom(dataRow);
        }

        public BaseWorkFlowStepEntity(DataTable dataTable)
        {
            this.ID = string.Empty;
            this.Step = string.Empty;
            this.FlowID = string.Empty;
            this.FullName = string.Empty;
            this.Property = string.Empty;
            this.AudiUserID = string.Empty;
            this.AudiRoleID = string.Empty;
            this.AudiDutyID = string.Empty;
            this.SortCode = string.Empty;
            this.Description = string.Empty;
            this.CreateUserID = string.Empty;
            this.CreateDate = string.Empty;
            this.ModifyUserID = string.Empty;
            this.ModifyDate = string.Empty;
            this.GetFrom(dataTable);
        }

        public void ClearProperty()
        {
            this.ID = string.Empty;
            this.Step = string.Empty;
            this.FlowID = string.Empty;
            this.FullName = string.Empty;
            this.Property = string.Empty;
            this.AudiUserID = string.Empty;
            this.AudiRoleID = string.Empty;
            this.AudiDutyID = string.Empty;
            this.SortCode = string.Empty;
            this.Enabled = false;
            this.Description = string.Empty;
            this.CreateUserID = string.Empty;
            this.CreateDate = string.Empty;
            this.ModifyUserID = string.Empty;
            this.ModifyDate = string.Empty;
        }

        public BaseWorkFlowStepEntity GetFrom(DataRow dataRow)
        {
            this.ID = dataRow[BaseWorkFlowStepTable.FieldID].ToString();
            this.Step = dataRow[BaseWorkFlowStepTable.FieldStep].ToString();
            this.FlowID = dataRow[BaseWorkFlowStepTable.FieldFlowID].ToString();
            this.FullName = dataRow[BaseWorkFlowStepTable.FieldFullName].ToString();
            this.Property = dataRow[BaseWorkFlowStepTable.FieldProperty].ToString();
            this.AudiUserID = dataRow[BaseWorkFlowStepTable.FieldAudiUserID].ToString();
            this.AudiRoleID = dataRow[BaseWorkFlowStepTable.FieldAudiRoleID].ToString();
            this.AudiDutyID = dataRow[BaseWorkFlowStepTable.FieldAudiDutyID].ToString();
            this.SortCode = dataRow[BaseWorkFlowStepTable.FieldSortCode].ToString();
            this.Enabled = dataRow[BaseWorkFlowStepTable.FieldEnabled].ToString() == "1";
            this.Description = dataRow[BaseWorkFlowStepTable.FieldDescription].ToString();
            this.CreateUserID = dataRow[BaseWorkFlowStepTable.FieldCreateUserID].ToString();
            this.CreateDate = dataRow[BaseWorkFlowStepTable.FieldCreateDate].ToString();
            this.ModifyUserID = dataRow[BaseWorkFlowStepTable.FieldModifyUserID].ToString();
            this.ModifyDate = dataRow[BaseWorkFlowStepTable.FieldModifyDate].ToString();
            return this;
        }

        public BaseWorkFlowStepEntity GetFrom(DataTable dataTable)
        {
            foreach (DataRow row in dataTable.Rows)
            {
                this.GetFrom(row);
                break;
            }
            return this;
        }
    }
}